#include <math.h>
#include "vector.h"
#include "point.h"


using namespace vivid;

Point& Point::operator =(Point const &aP)
{
	_x = aP._x;
	_y = aP._y;
	_z = aP._z;

	return *this;
}


Point Point::operator +(Vector const &aV) const
{
	return Point(_x + aV._x, _y + aV._y, _z + aV._z);
}


Point Point::operator -(Vector const &aV) const
{
	return Point(_x - aV._x, _y - aV._y, _z - aV._z);
}


Vector Point::operator -(Point const &aP) const
{
	return Vector(_x - aP._x, _y - aP._y, _z - aP._z);
}


VFloat Point::Dis(Point const & aP) const
{
	VFloat dx = _x - aP._x;
	VFloat dy = _y - aP._y;
	VFloat dz = _z - aP._z;

	return sqrt(dx * dx + dy * dy + dz * dz);
}


VFloat Point::DisSq(Point const & aP) const
{
	VFloat dx = _x - aP._x;
	VFloat dy = _y - aP._y;
	VFloat dz = _z - aP._z;

	return dx * dx + dy * dy + dz * dz;
}

